<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" %>
<%
	String DRV = "org.mariadb.jdbc.Driver";
	String URL = "jdbc:mariadb://localhost:3306/jwj8508?user=jwj8508&password=123456";
	String sql = "update boardv4 set title=?, uid=?, contents=? where bdno = ?";
	
	Connection conn = null;
	PreparedStatement pstmt = null;
%>
<%
	request.setCharacterEncoding("UTF-8");
	String bdno = request.getParameter("bdno");
	String title = request.getParameter("title");
	String uid = request.getParameter("uid");
	String contents = request.getParameter("contents");
	contents = contents.replace("\r\n", "<br />");
%>
<%
	try {
		Class.forName(DRV);
		conn = DriverManager.getConnection(URL);
		pstmt = conn.prepareStatement(sql);
		pstmt.setString(1, title);
		pstmt.setString(2, uid);
		pstmt.setString(3, contents);
		pstmt.setString(4, bdno);
		pstmt.executeUpdate();		
		
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		if (pstmt!=null)try{pstmt.close();}catch(Exception e){}
		if (conn!=null)try{conn.close();}catch(Exception e){}
	}
%>
<%
	try {response.sendRedirect("list.jsp");} catch(Exception e){}
%>
